#ifndef DYN_PLANARBILLIARD_NEXTIMPACTDIFF_H
#define DYN_PLANARBILLIARD_NEXTIMPACTDIFF_H

#include <cmath>

#include "../utilities/dyn_functor.h"

/*! \author Joey Dumont
 *
 *  \date 2012-10-08
 *
 *  \brief This encapsulates the derivative of the next impact function.
 *
 * We simply write the analytical expression for the derivative
 * of the straight line through the impact point and that
 * obeys the reflection law.
 */

class NextImpactDiff : public Functor
{
public:
    /*! Constructor supplies the minimal number of variables. */
    NextImpactDiff(Functor& _boundary,
                   Functor& _diffBoundary,
                   double _impactPoint=0.0,
                   double _direction=0.0);

    /*! @name Accessor Functions */
    //@{
    Functor& getBoundary(){return boundary;}
    Functor& getDiffBoundary(){return diffBoundary;}
    double getImpactPoint(){return impactPoint;}
    double getDirection(){return direction;}

    void setBoundary(Functor& _boundary){boundary=_boundary;}
    void setDiffBoundary(Functor& _diffBoundary){diffBoundary=_diffBoundary;}
    void setImpactPoint(double _impactPointer){impactPoint=_impactPointer;}
    void setDirection(double _direction){direction=_direction;}
    //@}

    /*! Re-declared pure virtual function. */
    double operator()(const double x);

protected:
    /*! @name Specialized variables */
    //@{
    Functor& boundary;
    Functor& diffBoundary;
    double impactPoint,direction;
    //@}
};

#endif // DYN_PLANARBILLIARD_NEXTIMPACTDIFF_H
